package cn.outsourcing.supermarket.controller;

import cn.outsourcing.supermarket.common.Result;
import cn.outsourcing.supermarket.common.utils.ResultUtils;
import cn.outsourcing.supermarket.dto.UserDetailDTO;
import cn.outsourcing.supermarket.service.HiolabsSettingsService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 前端控制器
 *
 * @author gzkemays
 * @since 2021-10-21
 */
@RestController
@RequestMapping("/settings")
public class HiolabsSettingsController {
  @Resource HiolabsSettingsService settingsService;

  @PostMapping("/save")
  public Result saveUserDetails(@RequestBody UserDetailDTO dto) {
    return ResultUtils.simpleResult( settingsService.saveUserDetail(dto));
  }

  @GetMapping("/userDetail")
  public Result getUserDetails() {
    return ResultUtils.simpleResult(settingsService.getUserDetail());
  }
}
